package com.zhongc.advance.common.code;

import java.awt.Color;

import org.springframework.beans.factory.FactoryBean;
/**
 * 
 *                       
 * @Filename ColorFactoryBean.java
 *
 * @Description 
 *
 * @Version 1.0
 *
 * @Author yhl
 *
 * @Email 363881815@qq.com
 *       
 * @History
 *<li>Author: yhl<>
 *<li>Date: 2014-8-16<>
 *<li>Version: 1.0<>
 *<li>Content: create<>
 * 
 */
public class ColorFactoryBean implements FactoryBean<Color> {
	
	private int alpha = 255;
	
	private int red = 0;
	
	private int green = 0;
	
	private int blue = 0;
	
	public void setAlpha(int alpha) {
		this.alpha = alpha;
	}

	public void setRed(int red) {
		this.red = red;
	}

	public void setGreen(int green) {
		this.green = green;
	}

	public void setBlue(int blue) {
		this.blue = blue;
	}

	@Override
	public Color getObject() throws Exception {
		return new Color(red, green, blue, alpha);
	}

	@Override
	public Class<?> getObjectType() {
		return Color.class;
	}

	@Override
	public boolean isSingleton() {
		return true;
	}

}
